export default {
  computed: {
    menu() {
      console.log(this.$store.getters.menu);
      return this.$store.getters.menu;
    }
  },
  methods: {
    getPower(keyWord, resultflag) {
      let mima;
      this.menu.find(({ sons }) => {
        if (sons[0].url === this.$route.path) {
          mima = sons[0].sons;
        } else {
          let t = sons[0].sons.some(({ url }) => {
            if (url.includes(":")) {
              url = url.split(":")[0];
              return this.$route.path.includes(url);
            } else {
              return url === this.$route.path;
            }
          });
          if (t) {
            mima = sons[0].sons;
          }
        }
      });
      let result = mima.find(({ keyword }) => {
        return keyword === keyWord;
      });
      if (!result) {
        if (resultflag) {
          return false;
        } else {
          this.$refs[keyWord].$el.style.display = "none";
        }
      } else {
        return true;
      }
    }
  }
};
